﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="RunRecords.aspx.vb" Inherits="Map.RunRecords" %>

<%@ Register TagPrefix="mnu" Namespace="Mysoft.Map.Application.Menus" Assembly="Mysoft.Map.Application.Components" %>
<%@ Register TagPrefix="cnt" Namespace="Mysoft.Map.Application.Controls" Assembly="Mysoft.Map.Application.Components" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="/_common/styles/global.css">
    <link rel="stylesheet" type="text/css" href="/_nav/menu.css">
    <link rel="stylesheet" type="text/css" href="/_grid/map_grid.css">
    <link href="_form/Form.css" rel="stylesheet" type="text/css" />
    <script language="javascript" src="/_common/scripts/global.js"></script>
    <script language="javascript" src="/_controls/settings.aspx"></script>

    <script language="javascript" src="/_controls/util/util.js"></script>

    <script language="javascript" src="/_controls/datetime/date.js"></script>
    <script language="javascript" src="/_forms/FormBase.js"></script>

    <%--日志管理系统的公用JS--%>

    <script src="Js/LMSCommon.js" type="text/javascript"></script>

</head>
<body ms_positioning="GridLayout" style="padding: 10px;" onload="window_onload()">
    <table style="font-size: 9pt;" height="100%" cellspacing="0" cellpadding="0" width="100%">
        <tr height="1">
            <td>
                <table style="font-size: 9pt;" height="100%" cellspacing="0" cellpadding="0" width="100%">
                    <tr height="1">
                        <td style="width:100px;"> 
                            选择时段：从
                        </td>
                        <td style="width:150px;">
                            <cnt:AppDateTimeII ID="appDateBegin" runat="server"></cnt:AppDateTimeII>
                        </td>
                        <td style="width:50px;text-align:center;">
                            到
                        </td>
                        <td style="width: 150px;">
                            <cnt:AppDateTimeII ID="appDatEnd" runat="server" ></cnt:AppDateTimeII>
                        </td>
                        <td style="padding-left:50px;">
                        <input type ="button" id="btnSearch" style="width:60px;height:25px;" value="查找" onclick ="Search()" />
                        </td>
                    </tr>
                </table>
               
            </td>
        </tr>
        <tr>
            <td style="height: 5px">
                &nbsp;<asp:Literal ID="Content" runat="server"></asp:Literal>
            </td>
        </tr>
        <tr height="1">
            <td>
                <mnu:AppGridMenu ID="appGridMenu1" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                <cnt:AppGrid ID="appGrid1" runat="server"   ShowPageCount ="true"  MultiSelect="false" />
            </td>
        </tr>
    </table>
</body>
</html>
<script type="text/javascript" >
    function window_onload()
    {
        if (__today == undefined || __lastMonth_today == undefined) return;
        
        var dtBegin = document.getElementById("appDateBegin_text");
        var dtEnd = document.getElementById("appDatEnd_text");

        if (dtBegin == undefined || dtEnd == undefined) return;
        
        dtEnd.value = __today;
        dtBegin.value = __lastMonth_today;
       
        Search();
    }

    function Search()
    {
        var dtBegin = document.getElementById("appDateBegin_text");
        var dtEnd = document.getElementById("appDatEnd_text");

        if (dtBegin == undefined || dtEnd == undefined) return;
        
        if (dtBegin.value == "")
        {
            alert("选择时段的开始日期未选择");
            return;
        }

        if (dtEnd.value == "")
        {
            alert("选择时段的截止日期未选择");
            return;
        }

        var result = compareDate(dtBegin.value, dtEnd.value);
        if (result == 1)
        {
            alert("选择时段的截止日期不能早于开始日期！");
            event.returnValue = false;
            return;
        }
        
        var filter = '  <filter type="and">'
            filter += '    <condition attribute="Lms_RunRecord.RecordTime" operator="ge"  value="' + dtBegin.value +" 00:00:00.000"+ '"/>'
            filter += '    <condition attribute="Lms_RunRecord.RecordTime" operator="le"  value="' + dtEnd.value +" 23:59:59.997"+ '"/>'
            filter += '</filter>'
        appGrid1.frameElement.filter = filter;
        appGrid1.frameElement.Query();        
    }
</script>